<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学员选择</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../static/js/base.js"></script>
    <script src="../../static/js/ax.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->

</head>
<body class="bg_w">

<div class="xyxx">
    <div class="layui-card-body">
        <form class="layui-form layui-form-pane" action="" lay-filter="component-form-element">
            <div class="layui-row layui-col-space10 layui-form-item">
                <div class="layui-inline layui-col-lg3 layui-col-sm6">
                    <label class="layui-form-label">姓名或证件号码</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" id="name" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-lg3 layui-col-sm6">
                    <a type="reset" class="layui-btn add_btn" id="search">搜索</a>
                </div>

            </div>
            <div class="layui-form-item">
                <table class="layui-hide" id="Tbale"
                       lay-filter="active"></table>
            </div>
            <!--模板-->

            <div class="layui-form-item layui-col-space10">
                <div class="layui-input-block">
                    <button type="reset" class="layui-btn layui-btn-primary btn-left">关闭</button>
                    <button class="layui-btn add_btn btn-left" id="btnSubmit" lay-submit lay-filter="component-form-element">提交</button>

                </div>
            </div>
        </form>
    </div>
</div>


</body>

<script>

    var table;
    var studentname=getQueryString("class");
    var collectionId=decodeURI(studentname);
    console.log(collectionId);

    layui.use(['table','form','laydate','layer','upload'], function() {
        table = layui.table;
        var form = layui.form,
            laydate = layui.laydate,
            layer=layui.layer,
            $ = layui.jquery,
            upload = layui.upload;


         // var collectionId = parent.$("#classname").val();
         // console.log(collectionId);

        //常规用法
        laydate.render({
            elem: '#enrolltime'
            ,range: true
        });

        var tableIns = ax.VTable({
            elem : '#Tbale',
            url :schoolWebUrl+'/api/studentExam/queryStudentYueKaoExam?examSubject='+collectionId+'',
            id:'student',
            title:'学员选择列表',
            cols : [ [
                {type : 'checkbox'},
                {field : 'id', width : 80, title : '序号'},
                {field : 'name', minWidth : 100, title : '姓名',},
                {field : 'certificatesNumber', minWidth : 180, title : '证件号码'},
                {field : 'carName', width : 150, title : '准驾车型'}
            ] ]

        });
        $('#search').click(function () {
            searchData();
        })
        function searchData() {
            //执行重载
            table.reload('student',{
                page : {
                    curr: 1 //重新从第 1 页开始
                },
                where : {
                    name : $('#name').val(),
                    // certificatesNumber : $('#name').val(),
                }
            });
        }

        //提交表单
        $('#btnSubmit').on('click', function(obj){
            var checkStatus = table.checkStatus('student');
            var   data = checkStatus.data;

            parent.document.getElementById("studentdata").value = JSON.stringify(data);
            // top._tools.GetValue(data);
            //  top._tools.GetValue(data); //GetValue是父界面的Js 方法
            var index = parent.layer.getFrameIndex(window.name);
            // parent.location.reload();
            parent.layer.close(index);

        });

    });


</script>
</html>